package com.qst.crop.entity;

import com.alipay.api.domain.MachineInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import java.util.Date;
import java.io.Serializable;


@Table(name = "tb_order")
@Schema(description = "订单实体类")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Order {

    /**
     * 订单id
     */
    @Id
    private Integer orderId;
    /**
     * 需求标题
     */
    @NotBlank(message = "标题不能为空")
    @Length(min = 2, max = 8, message = "title在2-8之间")
    private String title;
    /**
     * 期望价格
     */
    @Column(name = "price")
    @NotBlank(message = "price can not be empty")
    @Pattern(regexp = "^(([1-9]{1}\\d*)|(0{1}))(\\.\\d{1,2})?$", message = "请输入合理的价格，由数字组成，最多两位小数")
    private Double price;
    /**
     * 内容
     */
    @NotBlank(message = "内容不能为空")
    @Length(min = 10, max = 150, message = "内容长度在10-150之间")
    private String content;
    /**
     * 订单状态，0表示待合作，1表示待发货，2表示完成，3表示完成但未评价
     */
    private Integer orderStatus;
    /**
     * 1销售订单，2需求订单
     */
    @Column(name = "type")
    private String type;

    private String picture;
    /**
     * 发起订单人
     */
    private String ownName;
    /**
     * 合作人名字
     */
    private String cooperationName;

    private Date createTime;

    private Date updateTime;
    /**
     * 订单收货地址
     */
    @Length(min = 15, max = 30)
    private String address;

}
